package com.woniuxy.three.pms.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.woniuxy.three.pms.bean.CommentBean;



public interface CommentMapper {
	
	
	//查出该酒店的所有评论
	@Select("select * from comment order by create_time desc")
	public  List<CommentBean> findAll();
	
	//获取该酒店的平均得分
	@Select("select avg(level) as score  from comment ")
	public int findLevel();
	
	//根据订单号来查询该订单下的评论
	@Select("select  * from comment where order_id=#{id}")
	public CommentBean findByOrderId(int id);
	
	
	//添加评论
	@Insert("insert into comment (level,order_id,message,create_time) values (#{level},#{order_id},#{message},#{create_time})")
	public int addComment(CommentBean commentbean);
	
	
	//删除订单id来获取去修改相应的评论。评论
	@Delete("delete  from comment where  order_id=#{order_id}")
	public int delete(int order_id);
}
